<template>
  <h1 class="text-2xl my-4">{{ companyInfo.company_name }}</h1>
  <div class="leading-9">
    <p>
      <strong>电话：</strong>
      {{ companyInfo.phone }}
    </p>
    <p>
      <strong>邮箱：</strong>
      <span>{{ companyInfo.email }}</span>
    </p>
    <p>
      <strong>地址：</strong>
      <span>{{ companyInfo.address }}</span>
    </p>
    <p>
      <strong>网址：</strong>
      <a :href="siteLink">{{ siteLink }}</a>
    </p>
  </div>
</template>

<script setup>
// 同步接口返回公司信息
const { data: result } = await useAsyncData("companyInfo", () => {
  return useFetch("/api/companyInfo").then((res) => res.data.value);
});
const companyInfo = ref({});
if (result.value.code == 1) {
  companyInfo.value = result.value.data;
}
const siteLink = ref(location.origin);
</script>
<style scoped lang="scss"></style>
